import EventEmitter from 'events';
import LocalStorage from 'localstorage';
import { BrowserRouter } from 'react-router-dom';
// 事件总线
export const bus = new EventEmitter();
// 全局路由实例
export const router = new BrowserRouter();
// 通用LocalStorage工具
export const commonLs = new LocalStorage('common_');
// 跳转到登录并携带from信息
export const toLoginWithFrom = (ins) => {
  const { history } = ins || router;
  const { pathname } = history.location;
  history.push({ pathname: '/login' });
};
